package common.helper.toolkit;


import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by julianzliu on 4/18/2017.
 */
public class FolderToolkit {


    public static List<String> getAllFiles(String folder_path){
        File folder = new File(folder_path);
        File[] listOfFiles = folder.listFiles();

        List<String> files = new ArrayList<>();
        for (int i = 0; i < listOfFiles.length; i++) {
            if (listOfFiles[i].isFile()) {
                System.out.println("File " + listOfFiles[i].getName());
                files.add(listOfFiles[i].getAbsolutePath());
            } else if (listOfFiles[i].isDirectory()) {
                System.out.println("Directory " + listOfFiles[i].getName());
            }
        }
        return files;
    }


    public static void main(String[] args){
        String path = "C:\\";
        List<String> files = getAllFiles( path );
        for(String file_path: files){
            System.out.println( file_path );
        }
    }
}
